package com.eduhzy.ttw.teacher.di.module;

import android.support.v7.widget.GridLayoutManager;

import com.eduhzy.ttw.commonsdk.decoration.DividerItemDecoration;
import com.eduhzy.ttw.commonsdk.entity.HomeListData;
import com.eduhzy.ttw.commonsdk.entity.HomeSection;
import com.eduhzy.ttw.teacher.mvp.contract.HomeContract;
import com.eduhzy.ttw.teacher.mvp.model.HomeModel;
import com.eduhzy.ttw.teacher.mvp.ui.adapter.HomeMultiAdapter;
import com.jess.arms.di.scope.FragmentScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

/**
 * @author xubo
 * @date 2018-7-20 8:37:20
 */
@Module
public abstract class HomeModule {

    @Binds
    abstract HomeContract.Model bindHomeModel(HomeModel model);

    @FragmentScope
    @Provides
    static List<HomeSection<HomeListData>> provideList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static HomeMultiAdapter provideActivityAdapter(List<HomeSection<HomeListData>> list) {
        return new HomeMultiAdapter(list);

    }

    @FragmentScope
    @Provides
    static DividerItemDecoration provideDividerItemDecoration(HomeContract.View view) {
        return new DividerItemDecoration(view.getActivity(), DividerItemDecoration.VERTICAL_LIST);
    }

    @FragmentScope
    @Provides
    static GridLayoutManager provideLayoutManger(HomeContract.View view) {
        return new GridLayoutManager(view.getActivity(),4);
    }


}